<?php

    include_once('../util.php');

    $name = addslashes(trim($_POST['name']));
    $email = addslashes(trim($_POST['email']));
    $feedback = addslashes(trim($_POST['feedback']));

    $toaddress = "feedback@example.com";

    $mailcontent = "Customer name: ".$name."\n".
                   "Customer email: ".$email."\n".
                   "Customer comments:\n".$feedback."\n";

    $fromaddress = "From: webserver@example.com";

    // invoke mail() to send mail, need to configure the client mail program
    // mail($toaddress, $subject, $mailcontent, $fromaddress);

    $sampleemail = "jason@bigcustomer.com";
    $sampleemail = strtolower($sampleemail);
    $sampleemailspice = explode('@', $sampleemail);

    $emailfragments = array('bob', 'snriud.com');
    $email = implode('@', $emailfragments);

    echo $email;

    $teststr = "Is your name o'reilly? # haha";
    $afterteststr = addslashes($teststr);

    echo '<br />'.$afterteststr;

    $reafterteststr = stripslashes($afterteststr);
    $reafterteststr = strtolower($reafterteststr);
    $reafterteststr = ucwords($reafterteststr);

    $strarr = explode(' ', $reafterteststr);

    prettyDump($strarr);

    $name = 'tom';
    $namelist = 'tom,mary,john';

    $sampleemail = "lee.snriud@live.cn";
    $domain = strstr($sampleemail, '@');

    // print $domain;
    // var_dump(stristr($namelist, $name));
    // var_dump(strpos($namelist, $name));
    var_dump(str_replace($name, '###', $namelist));
    var_dump($namelist);

    $pattern = '^[a-zA-Z0-9_\-.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-.]+$';

    $arr = split('\.|@', $sampleemail);
    prettyDump($arr);

    echo '<br />'.$reafterteststr;
?>
<html>
<head>
    <title>Bob's Auto Parts - Feedback Submitted</title>
</head>
<body>
    <h1>Feedback submitted</h1>
    <p>Your feedback has been sent.</p>
</body>
</html>
